import { http } from '@/utils/http/axios';
import {BasicPageParams} from "@/api/authority/user";
import {RequestEnum} from "@/enums/httpEnum";

/**
 * @description: 获取日志分页
 */
export function getLogPage(
  page: BasicPageParams,
  params: {
    username?: string,
    ip?: string,
    code?: string,
    startTime?: string,
    endTime?: string
  }
) {
  return http.request({
    url: `/log/page/${page.pageNumber}/${page.pageSize}`,
    method: 'get',
    params
  });
}

/**
 * @description: 删除日志
 */
export function deleteLog(id: number) {
  return http.request({
    url: `/log/${id}`,
    method: RequestEnum.DELETE,
  }, {
    isShowSuccessMessage: true
  })
}

/**
 * @description: 批量删除日志
 */
export function deleteLogs(ids: number[]) {
  return http.request({
    url: `/log`,
    method: RequestEnum.DELETE,
    data: ids
  }, {
    isShowSuccessMessage: true
  })
}
